import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 拓展目标_渠道信息 */
export interface ExpandTargetChannel {
  id: number // ID
  name: string // 渠道名称
  location: string // 渠道区域
  address: string // 详细地址
  contactName: string // 联系人
  contactNumber: string // 联系电话
  relationLevel: string // 关系评估
  channelLevel: string // 渠道评估
  mainProduct: string // 主推我司产品
  countMethod: string // 计量方式
  revenueDescribe: string // 收益说明
  transferIntroduceSituation: string // 转介情况
  govSource: string // 政府资源
  personalSource: string // 企业/个人资源
  background: string // 渠道背景
  businessSituation: string // 业务情况
  growProcess: string // 成长历程
  advantage: string // 优势
  specialDescribe: string // 特殊说明
  ownerUserId: number // 拓展所属人id
}

// 拓展目标_渠道 API
export const ExpandTargetChannelApi = {
  // 查询拓展目标_渠道分页
  getExpandTargetChannelPage: async (params: any) => {
    return await request.get({ url: `/san/biz-expand-target-channel/page`, params })
  },

  // 查询拓展目标_渠道详情
  getExpandTargetChannel: async (id: number) => {
    return await request.get({ url: `/san/biz-expand-target-channel/get?id=` + id })
  },

  // 新增拓展目标_渠道
  createExpandTargetChannel: async (data: ExpandTargetChannel) => {
    return await request.post({ url: `/san/biz-expand-target-channel/create`, data })
  },

  // 修改拓展目标_渠道
  updateExpandTargetChannel: async (data: ExpandTargetChannel) => {
    return await request.put({ url: `/san/biz-expand-target-channel/update`, data })
  },

  // 删除拓展目标_渠道
  deleteExpandTargetChannel: async (id: number) => {
    return await request.delete({ url: `/san/biz-expand-target-channel/delete?id=` + id })
  },

  /** 批量删除拓展目标_渠道 */
  deleteExpandTargetChannelList: async (ids: number[]) => {
    return await request.delete({
      url: `/san/biz-expand-target-channel/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出拓展目标_渠道 Excel
  exportExpandTargetChannel: async (params) => {
    return await request.download({ url: `/san/biz-expand-target-channel/export-excel`, params })
  },
  checkExistByName: async (name: string) => {
    return await request.get({
      url: `/san/biz-expand-target-channel/checkExistByName?name=` + name
    })
  }
}
